#!/usr/bin/env python
# -*- coding=utf8 -*-
"""
# Author: bighu
# Created Time : 2022年03月18日 星期五 23时15分06秒
# File Name: 1.py
# Description:
"""
userInputLineOne = input()
a=userInputLineOne.split(" ")
b,c=int( a[0] ),int( a[1] )
inputlist = input()
listdata = inputlist.split(" ")
data=[]
for i in listdata:
    data.append(int(i))
data=[0]+data

for i in range(len(data)):
    if c<data[i]:
        break
data = data[:i+1]+[c]
temp=0
ans = 0
while True:
    try:
        ans+=temp*( data[temp+1]-data[temp] )
        temp+=1
    except:
        break
print(ans)

